

package com.example.administrator.caigou51.recyclerCard.cardView;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;

import com.example.administrator.caigou51.R;
import com.example.administrator.caigou51.recyclerCard.basic.CardItemView;
import com.example.administrator.caigou51.recyclerCard.card.TradeRecordCard;
import com.example.administrator.caigou51.util.DateUtil;

import java.text.SimpleDateFormat;


public class TradeRecordCardView extends CardItemView<TradeRecordCard> {
 	private Context mContext;
    public TradeRecordCardView(Context context) {
        super(context);
        mContext=context;
        // TODO Auto-generated constructor stub
    }

    public TradeRecordCardView(Context context, AttributeSet attrs) {
        super(context, attrs);
        mContext=context;
        // TODO Auto-generated constructor stub
    }

    public TradeRecordCardView(Context context,
                                    AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        mContext=context;
        // TODO Auto-generated constructor stub
    }
    private TextView textView_icon_rmb;
    private View viewFirstLine;
    private TextView textViewName;
    private TextView textViewPrice;
    private TextView textViewCount;
    private TextView textViewDate;
    private View relativeLayoutTop;
    private View linearLayoutTop2;
    @Override
    public void build(TradeRecordCard card) {
        // TODO Auto-generated method stub
        super.build(card);
        textView_icon_rmb = (TextView) findViewById(R.id.textView_icon_rmb);
        viewFirstLine = (View) findViewById(R.id.viewFirstLine);
        textViewName = (TextView) findViewById(R.id.textViewName);
        textViewPrice = (TextView) findViewById(R.id.textViewPrice);
        textViewCount = (TextView) findViewById(R.id.textViewCount);
        textViewDate = (TextView) findViewById(R.id.textViewDate);
        relativeLayoutTop=findViewById(R.id.relativeLayoutTop);
        linearLayoutTop2=findViewById(R.id.linearLayoutTop2);
        if (card.isFirst())
        {
            relativeLayoutTop.setVisibility(View.VISIBLE);
            linearLayoutTop2.setVisibility(View.VISIBLE);
            viewFirstLine.setVisibility(View.VISIBLE);
        }else
        {
            relativeLayoutTop.setVisibility(View.GONE);
            linearLayoutTop2.setVisibility(View.GONE);
            viewFirstLine.setVisibility(View.GONE);
        }
        textViewName.setText(card.getTradeBean().getBuyer());
        textViewPrice.setText(card.getTradeBean().getPrice());
        textViewCount.setText(card.getTradeBean().getNumber());

        String date=card.getTradeBean().getAddtime();

       // textViewDate.setText(DateUtil.getDefaultDay2(date));
        textViewDate.setText(date);
    }
}
